package com.example.lxy.androiddemo.dao;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.example.lxy.androiddemo.entity.City;
import com.example.lxy.androiddemo.entity.Note;
import com.example.lxy.androiddemo.entity.User;

import com.example.lxy.androiddemo.dao.CityDao;
import com.example.lxy.androiddemo.dao.NoteDao;
import com.example.lxy.androiddemo.dao.UserDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig cityDaoConfig;
    private final DaoConfig noteDaoConfig;
    private final DaoConfig userDaoConfig;

    private final CityDao cityDao;
    private final NoteDao noteDao;
    private final UserDao userDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        cityDaoConfig = daoConfigMap.get(CityDao.class).clone();
        cityDaoConfig.initIdentityScope(type);

        noteDaoConfig = daoConfigMap.get(NoteDao.class).clone();
        noteDaoConfig.initIdentityScope(type);

        userDaoConfig = daoConfigMap.get(UserDao.class).clone();
        userDaoConfig.initIdentityScope(type);

        cityDao = new CityDao(cityDaoConfig, this);
        noteDao = new NoteDao(noteDaoConfig, this);
        userDao = new UserDao(userDaoConfig, this);

        registerDao(City.class, cityDao);
        registerDao(Note.class, noteDao);
        registerDao(User.class, userDao);
    }
    
    public void clear() {
        cityDaoConfig.getIdentityScope().clear();
        noteDaoConfig.getIdentityScope().clear();
        userDaoConfig.getIdentityScope().clear();
    }

    public CityDao getCityDao() {
        return cityDao;
    }

    public NoteDao getNoteDao() {
        return noteDao;
    }

    public UserDao getUserDao() {
        return userDao;
    }

}
